// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-18

package ping

import (
	"context"
	"gitee.com/go-libs/result"
	"gitee.com/go-libs/runtime"
	"gitee.com/go-wares/framework-iris/framework/src/logics"
	"github.com/kataras/iris/v12"
)

type Logic struct {
	response *Response
}

func New() logics.Logical {
	return &Logic{
		response: &Response{},
	}
}

func (o *Logic) Run(_ context.Context, _ iris.Context) result.Result {
	counter := runtime.GetCounter()
	o.response.Logging = counter.LoggingCounter()
	o.response.MQ = counter.MqCounter()
	o.response.Process = counter.ProcessCounter()
	o.response.Processes = counter.ProcessCounter().GetMapper()
	return result.New().With(o.response)
}
